import sqlite3
# 二、插入数据：执行语句即可
conn = sqlite3.connect("tb.db")
cursor=conn.cursor()
username = "ytouch"
password = "123456"
user_id = 1

insert_data_sql = '''insert into happy
(username,password,id)
values 
(:st_name,:st_username,:st_id)'''

cursor.execute(insert_data_sql, {'st_name': username, 'st_username': password, 'st_id': user_id})

conn.commit()
cursor.close()